package org.jeecg.modules.fk.service;

import org.jeecg.modules.fk.mapper.auto.model.RiskFpFpgk;
import org.jeecg.modules.fk.mapper.auto.model.RiskFpSpmx;
import org.jeecg.modules.fk.mapper.auto.model.RiskFpSxy;
import org.jeecg.modules.fk.vo.req.*;
import org.jeecg.modules.fk.properties.TaxProperties;
import org.jeecg.modules.fk.repository.FkDaoRepository;
import org.jeecg.modules.fk.service.call.FkBszsApiBaseCall;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class RiskFpService {
    @Autowired
    private FkDaoRepository daoRepository;

    @Autowired
    private TaxProperties bszsProperties;

    @Autowired
    private FkBszsApiBaseCall fkBszsApiBaseCall;

    public List<RiskFpFpgk> getRiskFpFpgk(RiskFpFpgkDto req){
        return this.daoRepository.getRiskFpFpgkExtMapper().selectByParam(req.getNsrsbh(),req.getSkssqq(),req.getSkssqz(),null != req.getFplxDm() ? req.getFplxDm().getValue(): null);
    }

    public List<RiskFpSxy> getRiskFpSxy(RiskFpSxyDto req) {
        return this.daoRepository.getRiskFpSxyExtMapper().selectByParam(req.getNsrsbh(),req.getSkssqq(),req.getSkssqz(),null != req.getSxylxDm() ? req.getSxylxDm().getValue(): null);
    }

    public List<RiskFpSpmx> getRiskFpSpmx(RiskFpSpmxDto req) {
        return this.daoRepository.getRiskFpSpmxExtMapper().selectByParam(req.getNsrsbh(),req.getSkssqq(),req.getSkssqz(),null != req.getSpmxDm() ? req.getSpmxDm().getValue(): null);
    }
    

    public String getJxzffp(JxzffpDto req) {
        return  this.fkBszsApiBaseCall.postJsonParamReturnOneLevelCall(true, "进项作废发票分页查询生成日志记录",null,bszsProperties.getJxfpZfListUrl(), null, req);
    }

    public String getSxyFxqy(RiskSxyListFxqyDto req) {
//        bszsProperties.setSxyFxqyUrl("http://58.62.207.50:2161/tax-admin/nsxySxyqyServiceController/getSxyFxqy");
        return  this.fkBszsApiBaseCall.postJsonParamReturnOneLevelCallOfSxy(false, "获取检测企业上下游的风险企业",null,bszsProperties.getSxyFxqyUrl(), null, req);
    }

    public String getSxyFxqyFp(RiskSxyListFxqyFpDto req) {
        return  this.fkBszsApiBaseCall.postJsonParamReturnOneLevelCallOfSxy(false, "获取检测企业上下游风险企业的发票",null,bszsProperties.getSxyFxqyFpUrl(), null, req);
    }

    public String getSxyFxDetail(RiskSxyFxDetailDto req) {
        return  this.fkBszsApiBaseCall.postJsonParamReturnOneLevelCallOfSxy(false, "获取检测企业上下游的风险详情",null,bszsProperties.getSxyFxDetailUrl(), null, req);
    }

    public String getSxyYzqyList(NsxySxyYzqyListDto req) {
        return  this.fkBszsApiBaseCall.postJsonParamReturnOneLevelCallOfSxy(false, "获取检测企业上下游的优质企业",null,bszsProperties.getSxyYzqyListUrl(), null, req);
    }
}
